/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package whapper;

import java.math.BigDecimal;
/**
 *
 * @author f8368018
 */
public class Decimais {

    public static void main(String[] args) {

        double d1=0.6; //0.2
        double d2=0.3; //0.1

        d1=d1+d2;
        System.out.println("valor real:"+d1);
        System.out.println("floor:"+Math.floor(d1));
        System.out.println("ceil:"+Math.ceil(d1));
        System.out.println("round:"+Math.round(d1));//APROXIMADO
        System.out.printf("Com printf: %.1f \n",d1);//IMPRIMINDO COMO C++
        
        BigDecimal bigD1=new BigDecimal("0.6");
        BigDecimal bigD2=new BigDecimal("0.3");

        System.out.println("BigDecimal: "+bigD1.add(bigD2));
    }

}
